package com.laker.admin.common;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.laker.admin.framework.model.PageResponse;
import com.laker.admin.module.ext.entity.ExtLeave;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wfl
 * @date 2021年11月10日 14:31
 */
@RestController
@RequestMapping("/test")
public class TestController {


    @RequestMapping("/getAll")
    public PageResponse getAll(@RequestBody SearchModel searchModel) {
        IService retryService =  (IService)  SpringContextUtil.getBean(searchModel.getModelName()+"ServiceImpl");
        IPage<ExtLeave> page = retryService.page(searchModel.getPage(), searchModel.getQueryModel());
        return PageResponse.ok(page.getRecords(),page.getTotal());
    }
}
